<template>
  <div>
    <h1>home组件</h1>
    <h1>{{ info }}</h1>
    <h1>{{ count }}</h1>
    <h1>{{ evenOrOdd }}</h1>
    <button @click="add">加法</button>
    <button @click="decrementAct">减法</button>
  </div>
</template>

<script>
import { mapState, mapGetters, mapMutations, mapActions } from "vuex";
export default {
  mounted() {
    console.log(this.$store);
  },

  // 在computed中调用state和getters当中的数据
  computed: {
    ...mapState(["count", "info"]),
    ...mapGetters(["evenOrOdd"]),
  },

  methods: {
    ...mapActions(["decrementAct"]),
    ...mapMutations(["add"]),
  },
};
</script>

<style lang="scss" scoped>
</style>